package com.coollang.smartbra.views;

import android.annotation.TargetApi;
import android.content.Context;
import android.os.Build;
import android.util.AttributeSet;
import android.widget.ScrollView;

/**
 * Created by Administrator on 2016/8/18.
 */
public class GetMoveScrollView extends ScrollView {

    private ScrollChangeListener scrollViewListener = null;

    public GetMoveScrollView(Context context) {
        super(context);
    }

    public GetMoveScrollView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public GetMoveScrollView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @TargetApi(Build.VERSION_CODES.LOLLIPOP)
    public GetMoveScrollView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
        super(context, attrs, defStyleAttr, defStyleRes);
    }

    @Override
    protected void onScrollChanged(int l, int t, int oldl, int oldt) {
        super.onScrollChanged(l, t, oldl, oldt);

        if (scrollViewListener != null) {
            scrollViewListener.onScrollChanged(l, t, oldl, oldt);
        }
    }

    public void setScrollViewListener(ScrollChangeListener listener) {
        this.scrollViewListener = listener;
    }

    public interface ScrollChangeListener {
        public void onScrollChanged(int l, int t, int oldl, int oldt);
    }
}
